package com.xunheyun.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by ELI.ZHANG on 2017/2/6.
 *
 * 配置文件同步 Controller
 */
@Controller
@RequestMapping(value="sync")
public class ConfigSyncController {

    /**
     * 同步配置文件
     * @return  String
     */
    @RequestMapping(value = "sync")
    @ResponseBody
    public String sync(HttpServletRequest request){

        String hosts = request.getParameter("hosts");   // 同步的主机列表
        String configId = request.getParameter("configId");     // 配置的ID

        //1.  根据配置文件ID获取配置的具体信息


        //2.  根据 主机列表获取主机的配置信息(主机IP、端口、用户名、密码)


        //3.  调用 ssh 接口进行配置文件的下发

        return null;
    }

}
